package com.ihm.projetihm_v1.nf;

import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;

public class Graphe<T>
{
	//+++++++++++//
	// CONSTANTS //
	//+++++++++++//

	//++++++++++++//
	// ATTRIBUTES //
	//++++++++++++//
	
	private String mFolderTitle;
	public String getFolderTitle() { return this.mFolderTitle; }
	
	private List<T> mItems;
	public List<T> getItems() { return this.mItems; }
	
	private File mPanorama;
	public File getPanorama(){ return this.mPanorama; }
	public void setPanorama(File panorama){ this.mPanorama = panorama; }
	

	//++++++++++++++//
	// CONSTRUCTORS //
	//++++++++++++++//

	public Graphe()
	{
		this.mFolderTitle = "title_folder";
		this.mItems = new LinkedList<T>();
	}
	
	public Graphe(String titleFolder)
	{
		this.mFolderTitle = titleFolder;
		this.mItems = new LinkedList<T>();
	}
	

	//+++++++++//
	// METHODS //
	//+++++++++//
	
	public void addItem(T item)
	{
		this.mItems.add(item);
	}
	
	@Override
	public String toString()
	{
		String output = "Graphe{ ";
		for (T item : this.getItems())
		{
			output += item.toString() + " ; ";
		}
		
		return output += "}";
	}
	

	//++++++++++++++++//
	// STATIC METHODS //
	//++++++++++++++++//
	
	public static Graphe<Integer> getIdInstance(int id)
	{
		Graphe<Integer> g = new Graphe<Integer>();
		Random random = new Random();
		for (int i=0; i<random.nextInt(15)+3; i++)
		{
			g.addItem(id);
		}
		return g;
	}
}
